﻿using Microsoft.AspNetCore.Authentication.OAuth;

namespace AuthClientApi.OAuth.WeChat
{
    public class WeChatOptions : OAuthOptions
    {
        /// <summary>
        /// Initializes a new <see cref="WeChatOptions"/>.
        /// </summary>
        public WeChatOptions()
        {

            SignInScheme = "Cookies";
            CallbackPath = new PathString("/callback/login/local");
            StateAddition = "#wechat_redirect";
            SaveTokens = true;
            //PC端扫码登录授权地址
            AuthorizationEndpoint = "https://localhost:44319/connect/authorize";
            TokenEndpoint = "https://localhost:44319/connect/token";
            UserInformationEndpoint = "https://localhost:44319/connect/userinfo";
            //snsapi_base （不弹出授权页面，直接跳转，只能获取用户openid），
            //snsapi_userinfo （弹出授权页面，可通过openid拿到昵称、性别、所在地。并且，即使在未关注的情况下，只要用户授权，也能获取其信息）
            //snsapi_login pc端扫码登录
            //WeChatScope = "snsapi_login";
            WeChatScope = "snsapi_userinfo";
            IsUserInfoClaim = true;
        }
        public string AppId
        {
            get { return ClientId; }
            set { ClientId = value; }
        }
        public string AppSecret
        {
            get { return ClientSecret; }
            set { ClientSecret = value; }
        }
        public string StateAddition { get; set; }
        public string WeChatScope { get; set; }
        /// <summary>
        /// 是否将用户信息写入Claims
        /// </summary>
        public bool IsUserInfoClaim { get; set; }
    }
}
